<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class LearnVideoSectionStoreRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        if (request()->isMethod('PUT')) {
            return [
                'name' => 'bail|nullable|string',
                'total_size' => 'bail|nullable|numeric',
                'total_second' => 'bail|nullable|numeric',
                'video_format' => 'bail|nullable|string',
                'video_url' => 'bail|nullable|string',
                'sort' => 'bail|nullable|int'
            ];
        }

        return [
            'name' => 'bail|required|string',
            'learn_video_id' => 'bail|required|int',
            'learn_video_chapter_id' => 'bail|required|int',
            'total_size' => 'bail|nullable|numeric',
            'total_second' => 'bail|nullable|numeric',
            'video_format' => 'bail|required|string',
            'video_url' => 'bail|required|string',
            'sort' => 'bail|nullable|int'
        ];
    }
}
